package ecstore.server.dataOperation;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Item {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String name;
    
    @Persistent
    private float price;
    
    @Persistent
    private String size;
    
    @Persistent
    private String description;
    
    @Persistent
    private String category;
    
    @Persistent
    private String brand;
    
    @Persistent
    private String imageLocation;
    
    @Persistent
    private String thImageLocation;
    
    @Persistent
    private int windowNum;
    
    @Persistent 
    private int posRow;
    
    @Persistent
    private int posCol;
    
    @Persistent
    private int stock;
    
    @Persistent
    private int recmdStock;
    
    public Item(){
    	
    }
    
    public Item(String itemCategory, String itemBrand, 
    		String itemName, float itemPrice, String itemSize, String itemDescription,
    		String itemThumbnail, String itemImage, int itemStock, int itemRecmdStock
    		){
    	category = itemCategory;
    	brand = itemBrand;
    	name = itemName;
    	price = itemPrice;
    	size = itemSize;
    	description = itemDescription;
    	thImageLocation = itemThumbnail;
    	imageLocation = itemImage;
    	stock = itemStock;
    	recmdStock = itemRecmdStock;
    }
    
    // A constructor used by tobacco
    public Item(String itemCategory, String itemBrand, 
    		String itemName, float itemPrice, String itemSize, String itemDescription,
    		String itemThumbnail, String itemImage, int window, int row, int col, int itemStock, int itemRecmdStock
    		){
    	category = itemCategory;
    	brand = itemBrand;
    	name = itemName;
    	price = itemPrice;
    	size = itemSize;
    	description = itemDescription;
    	thImageLocation = itemThumbnail;
    	imageLocation = itemImage;
    	windowNum = window;
    	posRow = row;
    	posCol = col;
    	stock = itemStock;
    	recmdStock = itemRecmdStock;
    }
    
    
    public Key getKey(){
    	return key;
    }
    
    public String getName(){
    	return name;
    }
    
    public float getPrice(){
    	return price;
    }
    
    public String getSize(){
    	return size;
    }
    
    public String getDescription(){
    	return description;
    }
    
    public String getCategory(){
    	return category;
    }
    
    public String getBrand(){
    	return brand;
    }
    
    public String getThumbnail(){
    	return thImageLocation;
    }
    
    public String getImage(){
    	return imageLocation;
    }
    
    public int getWindowNum(){
    	return windowNum;
    }
    
    public int getRowNum(){
    	return posRow;
    }
    
    public int getColNum(){
    	return posCol;
    }
    
    public int getStock(){
    	return stock;
    }
    
    public int getRecmdStock(){
    	return recmdStock;
    }
    
    // Change the item property value
    public void setCategory(String newCategory){
    	category = newCategory;
    }
    
    public void setPrice(float newPrice){
    	price = newPrice;
    }
    
    public void setName(String newName){
    	name = newName;
    }
    
    public void setSize(String newSize){
    	size = newSize;
    }
    
    public void setDescription(String newDescription){
    	description = newDescription;
    }
    
    
    public void setBrand(String newBrand){
    	brand = newBrand;
    }
    
    public void setThumbnail(String newThumbnail){
    	thImageLocation = newThumbnail;
    }
    
    public void setImage(String newImage){
    	imageLocation = newImage;
    }
    
    public void setWindowNum(int newWindowNum){
    	windowNum = newWindowNum;
    }
    
    public void setRowNum(int newRowNum){
    	posRow = newRowNum;
    }
    
    public void setColNum(int newColNum){
    	posCol = newColNum;
    }
    
    public void setStock(int newStock){
    	stock = newStock;
    }
    
    public void setRecmdStock(int newRecmdStock){
    	recmdStock = newRecmdStock;
    }
}
